<!-- 人气推荐 -->

<template>
  <div class="home-new">
    <HomePanel ref="target" title="人气推荐" subTitle="人气爆款 不容错过">
      <template #youbian>
        <gengduo path="/"></gengduo>
      </template>
      <!-- 面板内容 -->
      <template #default>
        <Transition name="fade">
          <ul class="goods-list" v-if="homeStore.hotItemsList.length > 0">
            <li v-for="item in homeStore.hotItemsList" :key="item.id">
              <RouterLink to="/">
                <img v-lazy="item.picture" alt="" />
                <p class="name ellipsis">{{ item.title }}</p>
                <p class="price">{{ item.alt }}</p>
              </RouterLink>
            </li>
          </ul>
          <HomeSkeleton v-else></HomeSkeleton>
        </Transition>
      </template>
    </HomePanel>
  </div>
</template>
<script lang="ts" setup>
import HomePanel from './home-panel.vue'
import useStore from '@/store'
import { uselazy } from '@/utils/hooks'
import HomeSkeleton from './home-skeleton.vue'
const { homeStore } = useStore()
const target = uselazy(homeStore.getHotItemsList)
</script>
<style scoped lang="less">
.goods-list {
  display: flex;
  height: 406px;
  justify-content: space-around;
  li {
    width: 306px;
    height: 406px;
    background: #fff;
    .hoverShadow(); //混入
    img {
      width: 306px;
      height: 306px;
    }
    p {
      font-size: 20px;
      padding: 12px 30px 0 30px;
      text-align: center;
    }
    .price {
      font-size: 15px;
      color: #898989;
    }
  }
}
</style>
